import java.util.GregorianCalendar;
import java.util.StringTokenizer;

public class SubFood extends Food {

	String expirationDay;
	String buyDay;
	GregorianCalendar exirationDayGregorian;
	public GregorianCalendar getExirationDayGregorian() {
		return exirationDayGregorian;
	}

	public GregorianCalendar getBuyDayGregorian() {
		return buyDayGregorian;
	}

	GregorianCalendar buyDayGregorian;

	public SubFood(String aFoodName, String aDescription, double aAmount,
			String aUnitM, String aExpirationDay, String aBuyDay) {
		super(aFoodName, aDescription, aAmount, aUnitM);
		this.expirationDay = aExpirationDay;
		this.buyDay = aBuyDay;
		StringTokenizer st = new StringTokenizer(aExpirationDay);
		while (st.hasMoreTokens()) {
			int day = 0;
			int month = 0;
			int year = 0;
			day = Integer.parseInt(st.nextToken("/"));
			month = Integer.parseInt(st.nextToken("/"));
			year = Integer.parseInt(st.nextToken().replace(" ", ""));
			exirationDayGregorian = new GregorianCalendar(year, month, day);
		}
	}

	@Override
	public String toString() {
		return super.toString() + "expirationDay=" + expirationDay
				+ ", buyDay=" + buyDay + "]";
	}

	public String getExpirationDay() {
		return expirationDay;
	}

	public String getBuyDay() {
		return buyDay;
	}

	public void setExpirationDay(String expirationDay) {
		this.expirationDay = expirationDay;
	}

	public void setBuyDay(String buyDay) {
		this.buyDay = buyDay;
	}

}
